<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学校管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#add").click(function(){
				debugger;
				var schCode = $(this).parent().parent().find("td").eq(2).text();
				var schType = $(this).parent().parent().find("td").eq(3).text();
				var url = "${ctx }/sysschool/sysSchool/addForm?schCode="+schCode+"&schType="+schType;
				var height = window.screen.availHeight * 0.5;
				var width = window.screen.availWidth * 0.4;
				layer.open({
					type : 2,
					title : '添加班级',
					shadeClose : true,
					//skin : 'layui-layer-rim',
					shade : 0.8,
					resize : false,
					area : [ width + "px", height + "px" ],
					content : url
				});
			});

			$("#btnReset").click(function () {
				$("#schName").val("");
				$("#schCode").val("");
				$("#schType").val("").select2();
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
	<style type="text/css">
		.minWidth {
			min-width: 177px;
		}	
		.autoWidth {
		    width: auto;
		}	
		.select2-choices{
		    border-radius: 4px;
		}	
		#contentTable td ,#contentTable th{
			text-align: center;
			padding: 1px 20px;
		}
		#contentTable tbody tr td{
			font-size: 13px;
		}
   </style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sysschool/sysSchool/">学校列表</a></li>
		<shiro:hasPermission name="sysschool:sysSchool:edit"><li><a href="${ctx}/sysschool/sysSchool/form">学校添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="sysSchool" action="${ctx}/sysschool/sysSchool/" method="post" class="breadcrumb form-search" autocomplete="off">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="breadcrumb">
			<table class="table table-bordered">
				<tr>
				    <th>地区：</th>
					<td>
						<sys:treeselect2 id="parentCode" name="parentCode" value="${sysSchool.parentCode}" labelName="parentName" labelValue="${sysSchool.parentName}"
					    title="机构" url="/sys/office/treeData" cssClass="input-medium" layer = "true" disabled="disabled"/>
					</td>
					<th>学校名称：</th>
					<td>
						<form:input path="schName" id="schName" class="span2 minWidth"/>
					</td>
					<th>学校编码：</th>
					<td>
						<form:input path="schCode" id="schCode" class="span2 minWidth"/>
					</td>
				</tr>
				<tr>
				    <th>学段：</th>
					<td colspan="5">
						<form:select path="schType" id = "schType" class="span2 minWidth">
							<form:option value="" label="--请选择--"/>
							<form:options items="${fns:getDictList('schType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				</tr>
			</table>
		</div>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input id="btnReset" type="button" class="btn btn-primary" value="重置"/>
		<%--<input onclick="down()" class="btn btn-primary" type="button" value="导出"/>
		<input id="btnPrint" class="btn btn-primary" type="button" value="打印"/>--%>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>学校名称</th>
				<th>学校编码</th>
				<th>学段</th>
				<th>所属区域</th>
				<th>体检日期</th>
				<th>创建时间</th>
				<th>创建人</th>
				<shiro:hasPermission name="sysschool:sysSchool:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="sysSchool" begin="0" varStatus="status">
			<tr>
				<td>
				    ${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td>
				    ${sysSchool.schName}
				</td>
				<td>
				    ${sysSchool.schCode}
				</td>
				<td>
				    ${fns:getDictLabel(sysSchool.schType,'schType','')}
				</td>
				<td>
				    ${sysSchool.parentName}
				</td>
				<td>
					<fmt:formatDate value="${sysSchool.physicalDate}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					<fmt:formatDate value="${sysSchool.createDate}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
				    ${sysSchool.user.name}
				</td>
				<shiro:hasPermission name="sysschool:sysSchool:edit"><td>
    				<a href="${ctx}/sysschool/sysSchool/form?id=${sysSchool.id}">修改</a>
					<a href="${ctx}/sysschool/sysSchool/delete?id=${sysSchool.id}" onclick="return confirmx('确认要删除该学校管理吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>